{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
            <li><a href="{php echo $this->createWebUrl('project');}">返回项目列表</a></li>
            <li><a href="{php echo $this->createWebUrl('draw', array('id' => $project_id));}">{$project['title']}奖品列表</a></li>
            <li class="active"><a href="{php echo $this->createWebUrl('draw', array('act' => 'add', 'id' => $project_id));}">添加奖品</a></li>
	</ul>
	<form action="" class="form-horizontal form" method="post" autocomplete="off">
		<input type="hidden" name="draw_id" value="{$item['id']}">
		<input type="hidden" name="token" value="{$_W['token']}" />
		<input type="hidden" name="act" value="update" />
		<div class="panel panel-default">
			<div class="panel-heading">
                            {if !empty($id)}修改{else}添加{/if}{$project['title']}奖品
			</div>
			<div class="panel-body">
				<div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品名称</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" name="draw[name]" value="{$item['name']}" />
                                    </div>
				</div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品数量</label>
                                    <div class="col-sm-8">
                                        <input type="number" class="form-control" name="draw[numbers]" value="{$item['numbers']}" />
                                    </div>
				</div>
				<div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品类型</label>
                                    <div class="col-sm-8">
                                        <label class="radio-inline">
                                            <input type="radio" value="1" name="draw[type]" {if $item['type']==1}checked{/if}> 积分
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" value="2" name="draw[type]" {if $item['type']==2}checked{/if}> 余额
                                        </label>
                                        <label class="radio-inline" {if !$isWeixinPay} title="您的商户信息未设置或设置有误"{/if}>
                                            <input type="radio" value="3" name="draw[type]" {if !$isWeixinPay} disabled title="您的商户信息未设置或设置有误"{/if} {if $item['type']==3 && $isWeixinPay}checked{/if}> 微信零钱
                                        </label>
                                        <span class="help-block">
                                            <p><strong class="text-danger">提示：</strong>{if !$isWeixinPay} 您的商户信息未设置或设置有误,暂时无法选择微信零钱选项，<a href="{url 'profile/module/setting' array('m' => 'fr_hb')}">立即设置</a>{else}微信零钱需要认证服务号才能用{/if}</p>
                                        </span>
                                    </div>
				</div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品金额</label>
                                    <div class="col-sm-8">
                                        <div class="clearfix">
                                            <div class="col-sm-4" style="padding-left: 0">
                                                <div class="input-group">
                                                    <input class="form-control" type="number" value="{$item['prize']}" name="draw[prize]">
                                                    <span class="input-group-addon">分</span>
                                                </div>
                                            </div>
                                        </div>
                                        <span class="help-block">
                                            <p><strong class="text-danger">提示：</strong>0是没有奖励</p>
                                        </span>
                                    </div>
				</div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖概率</label>
                                    <div class="col-sm-8">
                                        <div class="clearfix">
                                            <div class="col-sm-4" style="padding-left: 0">
                                                <div class="input-group">
                                                    <input class="form-control" type="text" value="{$item['chance']}" name="draw[chance]">
                                                    <span class="input-group-addon">%</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
				</div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">显示顺序</label>
                                    <div class="col-sm-8">
                                        <input type="number" class="form-control" name="draw[sort]" value="{$item['sort']}" />
                                    </div>
				</div>
				<div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">&nbsp;</label>
                                    <div class="col-sm-9">
                                        <button type="submit" class="btn btn-primary col-lg-1" name="submit" value="提交">提交</button>
                                    </div>
				</div>
			</div>
		</div>
	</form>
</div>
{template 'common/footer'}